package gateway.mgt

import grails.converters.JSON
import utils.SingletonCoreHelper

class ApiReleaseController {

    def save(String id) {
        def apiGroupInstance = ApiGroup.get(id ?: 1)
        apiGroupInstance.publish()
        response.outputStream << "\n\nGenerate Routes Config: \n\n"
        response.outputStream << apiGroupInstance.toYamlString()
        response.outputStream << "\n\nRefresh Gateway Core: \n\n"
        response.outputStream << ([refresh: SingletonCoreHelper.refresh()] as JSON)
    }
}
